{template header}

<script src="js/common.js" type="text/javascript"></script>

<div class="container">
	<h3 class="marginbot tab">
		<!--{if $a != 'ls'}--><a href="{UC_ADMINSCRIPT}?m=field&a=ls" class="sgbtn">{lang field_ls}</a><!--{else}--><a>{lang field_ls}</a><!--{/if}-->
		<!--{if $a != 'add'}--><a href="{UC_ADMINSCRIPT}?m=field&a=add" class="sgbtn">{lang field_new}</a><!--{else}--><a>{lang field_new}</a><!--{/if}-->
	</h3>
	<!--{if $a == 'ls'}-->

		<div class="mainbox">
			<!--{if $fields}-->
				<form action="{UC_ADMINSCRIPT}?m=field&a=ls" method="post">
					<input type="hidden" name="formhash" value="{FORMHASH}">
					<table class="datalist fixwidth">
						<tr>
							<th nowrap="nowrap"><input type="checkbox" name="chkall" id="chkall" onclick="checkall('delete[]')" class="checkbox" /><label for="chkall">{lang app_delete}</label></th>
							<th nowrap="nowrap">{lang field_name}</th>
							<th nowrap="nowrap">{lang field_field}</th>
							<th nowrap="nowrap">{lang field_index}</th>
							<th nowrap="nowrap">{lang field_unique}</th>
						</tr>
						<!--{loop $fields $field}-->
							<tr>
								<td width="60"><input type="checkbox" name="delete[]" value="$field[field]" class="checkbox" /></td>
								<td width="200">$field[name]</td>
								<td width="250">$field[field] $field[type]</td>
								<td width="60"><input type="checkbox" name="index[{$field[field]}]" value="1" {if $field[index]}checked {/if}class="checkbox" /></td>
								<td><input type="checkbox" name="unique[{$field[field]}]" value="1" {if $field[unique]}checked {/if}class="checkbox" /></td>
							</tr>
						<!--{/loop}-->
						<tr class="nobg">
							<td colspan="5"><input type="submit" value="{lang submit}" class="btn" /></td>
						</tr>
					</table>
					<div class="margintop"></div>
				</form>
			<!--{else}-->
				<p class="empty">{lang list_empty}</p>
			<!--{/if}-->
		</div>
	<!--{elseif $a == 'add'}-->
		<div class="mainbox">
			<div id="custom">
				<form action="{UC_ADMINSCRIPT}?m=field&a=add" method="post">
				<input type="hidden" name="formhash" value="{FORMHASH}">
					<table class="opt">
						<tr>
							<th colspan="2">{lang field_name}:</th>
						</tr>
						<tr>
							<td><input type="text" class="txt" name="s[name]" value="" /></td>
							<td>{lang field_name_comment}</td>
						</tr>
						<tr>
							<th colspan="2">{lang field_field}:</th>
						</tr>
						<tr>
							<td><input type="text" class="txt" name="s[field]" value="" /></td>
							<td>{lang field_field_comment}</td>
						</tr>
						<tr>
							<th colspan="2">{lang field_type}:</th>
						</tr>
						<tr>
							<td>
								<label><input type="radio" class="radio" name="s[type]" value="int" checked onclick="show('unsigned', '');show('len', '')" /> {lang field_int}(int)</label><br />
								<label><input type="radio" class="radio" name="s[type]" value="double" checked onclick="show('unsigned', '');show('len', '')"  /> {lang field_double}(double)</label><br />
								<label><input type="radio" class="radio" name="s[type]" value="varchar" onclick="show('unsigned', 'none');show('len', '')"  /> {lang field_varchar}(varchar)</label><br />
								<label><input type="radio" class="radio" name="s[type]" value="text" onclick="show('unsigned', 'none');show('len', 'none')"  /> {lang field_text}(text)</label><br />
							</td>
							<td>{lang field_type_comment}</td>
						</tr>
						<tr id="len">
							<td>
								{lang field_len} <input type="text" class="txt" name="s[len]" style="width: 90px" />
							</td>
							<td>{lang field_len_comment}</td>
						</tr>
						<tr id="unsigned">
							<td>
								<label><input type="checkbox" class="checkbox" name="s[unsigned]" /> {lang field_unsigned}(unsigned)</label>
							</td>
							<td>{lang field_unsigned_comment}</td>
						</tr>
						<tr>
							<td>
								<label><input type="checkbox" class="checkbox" name="s[index]" value="1" /> {lang field_index}</label>
							</td>
							<td>{lang field_index_comment}</td>
						</tr>
						<tr>
							<td>
								<label><input type="checkbox" class="checkbox" name="s[unique]" value="1" /> {lang field_unique}</label>
							</td>
							<td>{lang field_unique_comment}</td>
						</tr>
					</table>
					<div class="opt"><input type="submit" name="submit" value=" {lang submit} " class="btn" /></div>
				</form>
			</div>
		</div>
	<!--{/if}-->
</div>

{template footer}